package com.steel.yfmall.cloud.assistant.stock.impl;

import com.steel.yfmall.cloud.assistant.stock.SteelBaseFreightBeanService;
import com.steel.yfmall.cloud.assistant.po.stock.SteelBaseFreightBean;
import com.steel.yfmall.cloud.assistant.stock.mapper.SteelBaseFreightBeanMapper;
import com.steel.yfmall.cloud.assistant.stock.mapper.SteelBaseFreightBeanMapperSync;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class SteelBaseFreightBeanServiceImpl implements SteelBaseFreightBeanService {

    @Resource
    private SteelBaseFreightBeanMapper steelBaseFreightBeanMapper;

    @Resource
    private SteelBaseFreightBeanMapperSync steelBaseFreightBeanMapperSync;

    @Override
    public boolean insertOrUpdateFreightBeanInfo(SteelBaseFreightBean record) {
        if(record == null || StringUtils.isBlank(record.getName())){
            log.warn("更新或则修改运费信息,运费单据编号为空!无法更新!");
            return false;
        }

        return steelBaseFreightBeanMapperSync.insertOrUpdateBaseFreight(record) > 0 ? true : false;
    }
}
